<%@ page import="cn.io0288.blog2.db.Articles" %>
<%@ page import="cn.io0288.blog2.model.Article" %>
<%@ page import="static cn.io0288.blog2.utils.StringUtils.cut_str" %>
<%@ page import="static cn.io0288.blog2.utils.DateUtils.timeStamp2Date" %>
<%@ page import="cn.io0288.blog2.db.Classify" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<section class="row row-cols-1 row-cols-sm-2 mu-3 mb-3">
    <% for (Article a : Articles.getArticles()) { %>

    <div class="card card-hover-image-rise container mu-3 mb-3" style="max-width: 540px;">
        <article class="row no-gutters">
            <div class="col-md-4">
                <a class="stretched-link" href="/article/<%=a.aid%>">
                    <img class="card-img"
                         style="object-fit: cover;padding: 22px 0;height: 100%;width: 100%; max-height: 170px;"
                         src="<%=a.img%>" alt="<%=a.img_alt%>">
                </a>
            </div>
            <div class="col-md-8">
                <div class="card-body">
                    <h5 class="card-title"><%=cut_str(a.title, 12, "…")%>
                    </h5>
                    <h6 class="card-subtitle mb-2 text-muted">
                        <%=cut_str(a.title2, 16, "…")%>
                    </h6>
                    <p class="card-text">
                        <%=cut_str(a.content, 16, " ")%>
                        <a class="stretched-link" href="/article/<%=a.aid%>">…</a>
                    </p>
                    <p class="card-text"><small
                            class="text-muted">最后修改于：<%=timeStamp2Date(Long.valueOf(a.lastdate))%> |
                        <%=Classify.getClassify(a.cid)%> | aid:<%=a.aid%>
                    </small></p>
                </div>
            </div>
        </article>
    </div>
    <% } %>
</section>